import launch
import launch_ros
from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
import os
from launch.actions import ExecuteProcess, IncludeLaunchDescription, TimerAction
from launch.launch_description_sources import PythonLaunchDescriptionSource

def generate_launch_description():
    
    
    #获取功能包share路径
    urdf_package_path = get_package_share_directory('botarm_controller')
    # default_xacro_path = os.path.join(urdf_package_path,'urdf','Sevenbot_urdf.xacro')
    default_gazebo_path = os.path.join(urdf_package_path,'launch','gazebo_arm.launch.py')
    
    return LaunchDescription([
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource(default_gazebo_path)
        ),

        Node(
            package='controller_manager',
            executable='spawner',
            output='screen',
            arguments=["joint_state_broadcaster"]),

        Node(
            package='controller_manager',
            executable='spawner',
            output='screen',
            arguments=["joint_trajectory_controller"]),
    ])